package com.fin.zw.aiqas.mapper;

import com.fin.zw.aiqas.model.component.ServiceDynamicModel;
import com.fin.zw.aiqas.model.component.ServiceLeftModel;
import com.fin.zw.aiqas.model.data.InspectionDetailModel;
import com.fin.zw.aiqas.model.data.ResultDetailModel;
import com.fin.zw.aiqas.model.data.StatisticsDetailModel;
import com.fin.zw.aiqas.model.request.ReconsiderationApprovalRequest;
import com.fin.zw.aiqas.model.request.RuleHistRequest;
import com.fin.zw.aiqas.model.request.RuleStatisticsRequest;
import com.fin.zw.aiqas.model.request.StatisToServiceRequest;
import com.fin.zw.aiqas.model.response.RuleStatisticsResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Mapper
@Repository

public interface RuleStatisticsMapper {

    List<RuleStatisticsResponse> selectRuleStatistics(RuleStatisticsRequest request);
    Integer selectRuleStatisticsCount(RuleStatisticsRequest request);

    List<ServiceLeftModel> selectCustomerServer(StatisToServiceRequest request);

    ResultDetailModel queryDetails(Long detailId);

    List<InspectionDetailModel> queryAllDetails(ReconsiderationApprovalRequest request);
    Integer queryCountAllDetails(ReconsiderationApprovalRequest request);

    /**
     * 根据规则id查询命中的记录
     *
     * @param request
     * @return
     */
    List<InspectionDetailModel> selectInspectionDetailByRuleId(RuleHistRequest request);
    Integer selectCountInspectionDetailByRuleId(RuleHistRequest request);

    /**
     * 查询当天执行质检录音的数量
     *
     * @return
     */
    Integer selectCountInspectionDetailByDate();

    /**
     * 统计当天命中的规则数量
     *
     * @return
     */
    Integer selectCountRuleByDate();

    /**
     * 查询时间段内每一天的数量
     *
     * @param startTime
     * @param endTime
     * @return
     */
    List<StatisticsDetailModel> selectDetailByDate(@Param("startTime") Date startTime,
                                                   @Param("endTime") Date endTime);

    List<StatisticsDetailModel> selectInspectionByRule(@Param("startTime") Date startTime,
                                                       @Param("endTime") Date endTime);

    /**
     * 客服统计查询右边动态数据
     *
     * @return
     */
    List<ServiceDynamicModel> queryServiceDynamic(StatisToServiceRequest request);
}
